import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


export default new Router({
// export default router = new Router({
  mode: "history",
  scrollBehavior: () => ({y: 0}),
  routes: [
    {
      path: '/',
      name: 'index',
      meta: { title: '主页', noCache: true},
      component: (resolve) => require(['@/views/index'], resolve),
    },
    {
      path: '/login',
      name: 'login',
      meta: { title: '登录', noCache: true },
      component: (resolve) => require(['@/views/login'], resolve),
    }
  ]
})

// router.beforeEach((to, from, next) => {
  // if (!localStorage.getItem("token")) {
  //   next({path: '/login'})
  // }
// })
